<meta charset="UTF-8">
<script src="jquery.js"></script>

<table style="border-collapse: collapse"
border="1" cellpadding="5" width="100%"
>
    <tr><td>1</td></tr>
    <tr><td>2</td></tr>
    <tr><td>3</td></tr>
    <tr><td>4</td></tr>
    <tr><td>5</td></tr>
    <tr><td>6</td></tr>
    <tr><td>7</td></tr>
    <tr><td>8</td></tr>
</table>

<script>
//    var trs = document.getElementsByTagName("tr");
//
//    for(var i=0;i<trs.length;i++){
//        if(i%2!=0){
//            trs[i].style.background = "#ccc";
//        }
//    }
    $("tr:odd").css("background","#ccc");
</script>








